package com.dubbo.demo.provider.study;

import org.apache.dubbo.common.utils.NamedThreadFactory;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author: Carlos
 * @create: 2021/02/08 14:59
 */
public class Export {

    private static final ScheduledExecutorService delayExportExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("export-", true));

    private void export() {
        // this::doExport -> Runnable
        delayExportExecutor.schedule(this::doExport, 100, TimeUnit.MINUTES);
    }

    protected void doExport() {
        // do something
    }

}
